package com.itbaiyun.agent.agent;


import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.model.ChatModel;
import org.springframework.ai.tool.ToolCallback;
import org.springframework.stereotype.Component;

/**
 * 超级智能体, 能够自主规划
 */
@Component
public class Manus extends ToolCallAgent{


    public Manus(ToolCallback[] availableTools, ChatModel dashscopeChatModel) {
        super(availableTools);
        this.setName("MyManus");
        String SYSTEM_PROMPT = " You are Manus, an all-capable AI assistant, aimed at solving any task presented by the user."
                + "You have various tools at your disposal that you can call upon to efficiently complete complex requests. ";
        this.setSystemPrompt(SYSTEM_PROMPT);
        String NEXT_STEP_PROMPT = "Based on user needs, proactively select the most appropriate tool or combination of tools."+
                "For complex tasks, you can break down the problem and use different tools step by step to solve it."+
                "After using each tool, clearly explain the execution results and suggest the next steps."+
                "If you want to stop the interaction at any point, use the `terminate` tool/function call.";
        this.setNextPrompt(NEXT_STEP_PROMPT);
        this.setMaxStep(20);
        // 初始化 AI 对话客户端
        ChatClient chatClient = ChatClient.builder(dashscopeChatModel)
                .build();
        this.setChatClient(chatClient);
    }
}
